package main

import "fmt"

func main() {
	fmt.Println(twoSum([]int{3, 9, 12, 15}, 18))
}

func twoSum(price []int, target int) []int {
	left, right := 0, len(price)-1
	for left < right {
		sum := price[left] + price[right]
		if sum > target {
			right--
		} else if sum < target {
			left++
		} else {
			return []int{price[left], price[right]}
		}
	}
	return nil
}
